package java67_18;

import java.util.InputMismatchException;
import java.util.Scanner;

public class SelCourse5 {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		try {
			System.out.println("请输入总课时:");
			int total = in.nextInt();
			System.out.println("请输入课程数:");
			int num = in.nextInt();
			int avg = total / num;
			System.out.println("平均每门课课时是" + avg + "节");
		} /*
			 * catch (Exception e) { System.out.println("其他错误"); e.printStackTrace(); }
			 */ catch (InputMismatchException e) {
			System.out.println("输入的不是数字 " + e);
			e.printStackTrace();
		} catch (ArithmeticException e) {
			System.out.println("课程数不能是0");
			e.printStackTrace();
		} catch (Exception e) {
			System.out.println("其他错误");
			e.printStackTrace();
		} finally {
			System.out.println("谢谢惠顾");
		}
	}

}
